package com.huayi.order;

import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.util.Properties;

/**
 * 描述：
 *
 * @author qlp
 * @date 2019-11-08 13:58
 */
public class DataConfigObject {
    //创建 SingleObject 的一个对象
    private static DataConfigObject instance = new DataConfigObject();
    private Integer pageSize = 10;


    //让构造函数为 private，这样该类就不会被实例化
    private DataConfigObject() {
        try {
            Properties properties = PropertiesLoaderUtils.loadAllProperties("config.properties");
            pageSize = Integer.parseInt(properties.getProperty("pageSize"));

        } catch (Exception e) {
            pageSize = 10;
        }
    }

    //获取唯一可用的对象
    public static DataConfigObject getInstance() {
        return instance;
    }

    public Integer getPageSize() {
        return pageSize;
    }

}
